#ifndef LIBRARY_RESOURCE_H
#define LIBRARY_RESOURCE_H

#include "rentry.h"

namespace Library
{

typedef struct _Resource * _pResource;

/**
 * A pseudo class which implements object like methods for void pointer
 * (void *) resources.
 */
class PLIBEXP Resource
{
	friend class ResourceEntry;
	friend class ResourceEntryWriter;

	public:
		static bool8			release(void * resource);

		static String			name(void * resource);
		static uint32			size(void * resource);
		static uint32			useCount(void * resource);

		static void *			userData(void * resource);
		static void				userData(void * resource, void * data);

	protected:
		static uint32			offset(void * resource);
		static void *			allocate(pResourceEntry owner, uint32 size);
		static void				deallocate(void * resource);

	private:
		static _pResource		head(void * resource);
		static pResourceEntry	owner(void * resource);

	// prohibited
	private:
		Resource();
		~Resource();
		Resource(Resource &);
		Resource & operator=(Resource &);
};


//----------------------------------------------------------------------------
// Documentation, prohibited methods (unimplemented)
//

/**
 * @fn Library::Resource::Resource()
 *
 * This method is reserved and unimplemented.  It has been defined for
 * Orthodox Canonical Form (OCF) compliance as well as restrict instantiation
 * since this is not a real class.
 */

/**
 * @fn Library::Resource::~Resource()
 *
 * This method is reserved and unimplemented.  It has been defined for
 * Orthodox Canonical Form (OCF) compliance as well as restrict destruction
 * since this is not a real class.
 */

/**
 * @fn Library::Resource::Resource(Library::Resource &)
 *
 * This method is reserved and unimplemented.  It has been defined for
 * Orthodox Canonical Form (OCF) compliance to prevent shallow object copies
 * from inadvertent use.
 */

/**
 * @fn Library::Resource & Library::Resource::operator=(Library::Resource &)
 *
 * This method is reserved and unimplemented.  It has been defined for
 * Orthodox Canonical Form (OCF) compliance to prevent shallow object copies
 * from inadvertent use.
 */

}; // namespace Library

#endif
